cmake_minimum_required(VERSION 3.5)
project(year)

SET(EXECUTABLE_OUTPUT_PATH $ENV{HOME}/work/github/c-templates/bin)
SET(LIBRARY_OUTPUT_PATH $ENV{HOME}/work/github/c-templates/lib)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

macro(source_group_by_dir source_files)
    set(sgbd_cur_dir ${CMAKE_CURRENT_SOURCE_DIR})
    foreach(sgbd_file ${${source_files}})
        string(REGEX REPLACE ${sgbd_cur_dir}//(.*/) //1 sgbd_fpath ${sgbd_file})
        string(REGEX REPLACE "/(.*/)/.*" //1 sgbd_group_name ${sgbd_fpath})
        string(COMPARE EQUAL ${sgbd_fpath} ${sgbd_group_name} sgbd_nogroup)
        string(REPLACE "/" "//" sgbd_group_name ${sgbd_group_name})
        if(sgbd_nogroup)
            set(sgbd_group_name "//")
        endif(sgbd_nogroup)
        source_group(${sgbd_group_name} FILES ${sgbd_file})
    endforeach(sgbd_file)
endmacro(source_group_by_dir)

add_definitions("-g -std=c++20")

FILE(GLOB_RECURSE all_files
	*.c
        )

link_directories("$ENV{HOME}/work/github/c-templates/lib/")

source_group(all_files)
include_directories($ENV{HOME}/work/github/c-templates/include/)
include_directories($ENV{HOME}/work/github/c-templates/3rdparty/include/)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
add_executable(year year.cpp)
target_link_libraries(year pthread)





